import type { FieldRule } from 'vant'

const MobileRules: FieldRule[] = [
  { required: true, message: '请输入手机号码' },
  {
    pattern: /^1[3-9]\d{9}$/,
    message: '手机号码格式错误'
  }
]
const PasswordRules: FieldRule[] = [
  {
    required: true,
    message: '密码不能为空',
    trigger: 'onBlur'
  },
  {
    pattern: /^\w{8,24}$/,
    message: '密码需为8-24个字符',
    trigger: 'onBlur'
  }
]
const codeRules: FieldRule[] = [
  {
    required: true,
    message: '验证码不能为空',
    trigger: 'onBlur'
  },
  {
    pattern: /^\d{6}$/,
    message: '请输入六位验证码',
    trigger: 'onBlur'
  }
]
const patientNameRules: FieldRule[] = [
  {
    required: true,
    message: '真实姓名不能为空'
  }
]
const patientCardRules: FieldRule[] = [
  { required: true, message: '身份证号不能为空' },
  {
    pattern:
      /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/,
    message: '身份证号不正确'
  }
]
export {
  MobileRules,
  PasswordRules,
  codeRules,
  patientNameRules,
  patientCardRules
}
